<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">

        <ui:define name="content">
            <h:form prependId="false">

                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                </h:panelGroup>
                <h:outputText escape="false" value="No log found" rendered="#{batchEntityController.CGbatchesLog.rowCount == 0}"/>

                <p:panel toggleable="true" id="batchList" header="Inbound Completed Goods Log" rendered="#{batchEntityController.CGbatchesLog.rowCount > 0}">
                    <p:dataTable value="#{batchEntityController.CGbatchesLog}" 
                                 var="item"  
                                 style="table-layout:fixed" paginator="true" rows="10"  
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                 rowsPerPageTemplate="5,10,15">  
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Batch #"/>
                            </f:facet>
                            <h:outputText value="#{item.id}"/>
                        </p:column>
                        <p:column filterBy="#{item.product.productName}" >
                            <f:facet name="header">
                                <h:outputText value="Product"/>
                            </f:facet>
                            <h:outputText value="#{item.product.productName}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Quantity (Cases)"/>
                            </f:facet>
                            <h:outputText value="#{item.quantity}"/>
                        </p:column>

                        <p:column >
                            <f:facet name="header">
                                <h:outputText value="Date Received"/>
                            </f:facet>
                            <h:outputText value="#{item.dateEntered}"/>
                        </p:column>
                    </p:dataTable> 
                </p:panel>
                
                     <p:panel toggleable="true" id="outBoundBatchList" header="Outbound Completed Goods Log" rendered="#{outboundCompletedGoodsEntityController.items.rowCount > 0}">
                    <p:dataTable value="#{outboundCompletedGoodsEntityController.items}" 
                                 var="item"  
                                 style="table-layout:fixed" paginator="true" rows="10"  
                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                 rowsPerPageTemplate="5,10,15">  
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Batch #"/>
                            </f:facet>
                            <h:outputText value="#{item.batch.id}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Product"/>
                            </f:facet>
                            <h:outputText value="#{item.batch.product.productName}"/>
                        </p:column>
                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Quantity (Cases)"/>
                            </f:facet>
                            <h:outputText value="#{item.quantityRemoved}"/>
                        </p:column>

                        <p:column>
                            <f:facet name="header">
                                <h:outputText value="Date Removed"/>
                            </f:facet>
                            <h:outputText value="#{item.createdAt}"/>
                        </p:column>
                         <p:column>
                            <f:facet name="header">
                                <h:outputText value="Reason"/>
                            </f:facet>
                            <h:outputText value="#{item.type}"/>
                        </p:column>
                    </p:dataTable> 
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
